package com.teaphy.coroutinecrawler.flow.operators

import kotlinx.coroutines.flow.*
import kotlinx.coroutines.runBlocking

fun main() = runBlocking {
    val first = flow {
        println("flow --> start")
        emit(1)
        emit(2)
        emit(3)
        println("flow --> end")
    }.first(::isEnv)

    println("first: $first")

    println("Done")
}

suspend fun isEnv(num: Int) = num % 2 == 0
